package cn.keniykey.mc.landterritory.command.landadmin;

import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;

import cn.keniykey.mc.landterritory.command.AbCommandBase;
import cn.keniykey.mc.landterritory.config.ConfigurationManager;
import cn.keniykey.mc.landterritory.config.LanguageManager;
import cn.keniykey.mc.landterritory.config.ViewsConfiguration;
import cn.keniykey.mc.landterritory.config.WorldsConfiguration;
import cn.keniykey.mc.landterritory.event.LandTerritoryReloadConfigEvent;
import cn.keniykey.mc.landterritory.landflag.api.LandFlagConfigurationFile;

public final class CommandReload extends AbCommandBase {
	CommandReload() {
		super("reload", "land.command.reload", false);
	}
	
	@Override
	public boolean execute(CommandSender sender, List<String> parameter) {
		ConfigurationManager.reloadConfiguration();
		LanguageManager.reloadLanguageConfiguration();
		ViewsConfiguration.reloadViewsConfiguration();
		WorldsConfiguration.reloadWorldsConfiguration();
		LandFlagConfigurationFile.load();
		Bukkit.getPluginManager().callEvent(new LandTerritoryReloadConfigEvent());
		LandFlagConfigurationFile.changeSave();
		sender.sendMessage(LanguageManager.getChatLang(1203111));
		return true;
	}
	@Override
	public List<String> prompt(CommandSender sender, List<String> parameter) {
		return emptylist;
	}
	@Override
	public String usage() {
		return LanguageManager.getLang(1203110);
	}
}